import wx

# 全局注册帮助对象
provider = wx.SimpleHelpProvider()
wx.HelpProvider.Set(provider)

class CustomizeDialog(wx.Dialog):

    def __init__(self, parent):
        wx.Dialog.__init__(self, parent, id = wx.ID_ANY, title = '人性化控件提示', size=(360, 200)
            , style = wx.DEFAULT_DIALOG_STYLE
            | wx.MAXIMIZE_BOX
            | wx.MINIMIZE_BOX
            | wx.RESIZE_BORDER
            | wx.DIALOG_EX_CONTEXTHELP
            | wx.DIALOG_NO_PARENT
            | wx.STAY_ON_TOP
        )
        self.panel = wx.Panel(self)
        self.panelSizer = wx.BoxSizer(wx.VERTICAL)
        self.panel.SetSizer(self.panelSizer)

        self.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP) # 会覆盖最大化最小化按钮

        self.label = wx.StaticText(self.panel, -1, '我是标签')
        self.label.SetHelpText('我是标签，用于存储提示信息') # 点击问号按钮后，再点击控件，会弹出提示信息
        self.panelSizer.Add(self.label, 0, wx.EXPAND | wx.ALL, 6)

        # 其它控件均有 SetHelpText() 方法，使用方法一样。

class MainFrameGUI(wx.Frame):

    def __init__(self, parent = None):
        wx.Frame.__init__(self, parent, id = wx.ID_ANY, title = '人性化控件提示', pos = wx.DefaultPosition, size = wx.Size(300, 300), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL)
        self.panel = wx.Panel(self)
        self.panelSizer = wx.BoxSizer(wx.VERTICAL)
        self.panel.SetSizer(self.panelSizer)

        self.btn_sys = wx.Button(self.panel, -1, '点击打开自定义对话框', style=wx.NO_BORDER)
        self.panelSizer.Add(self.btn_sys, 0, wx.EXPAND | wx.ALL, 2)
        self.Bind(wx.EVT_BUTTON, self.OnBtnSys, self.btn_sys)

    def OnBtnSys(self, evt):
        '''打开自定义对话框'''
        dlg = CustomizeDialog(self)
        dlg.ShowModal()
        dlg.Close(True)
class App(wx.App):

    def __init__(self, redirect=False, filename=None, useBestVisual=False, clearSigInt=True):
        wx.App.__init__(self, redirect, filename, useBestVisual, clearSigInt)

    def OnInit(self):
        self.frame = MainFrameGUI()
        self.frame.SetWindowStyle(wx.DEFAULT_FRAME_STYLE)
        self.frame.Show(True)
        self.SetTopWindow(self.frame)
        return True

    def OnExit(self):
        return super().OnExit()

if __name__ == '__main__':
    app = App(redirect=False)
    app.MainLoop()
